Skip to content

feat: implement GetKey for KeyMap and DescriptorSecretKey #851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

oleonardolima
Copy link

fixes #709

Description

I've built upon Tobin's work in #765 (see #765 (comment)) to implement the GetKey trait for KeyMap, a feature that will enable us to entirely remove the signers API from bdk_wallet, see: bitcoindevkit/bdk_wallet#70 and bitcoindevkit/bdk_wallet#235.

Notes to the reviewers

I followed some of Poelstra's previous comments to reduce the number of required matching branches, and also some VM's suggestions on implementing the main GetKey logic for DescriptorSecretKey instead.

Let me know if you have any other suggestions or comments.

Changelog notice

# Added:
 - implemented `GetKey` trait for `KeyMap`
 - implemented `GetKey` trait for `DescriptorSecretKey`

# Changed
 - moved `KeyMap` to it's own `key_map` module, replacing the `BTreeMap` alias.

tcharding and others added 2 commits August 22, 2025 17:21
- creates a new `key_map` module, and `KeyMap` type to replace the
  existing `BTreeMap` alias.
- it's a commit extracted from superseded PR rust-bitcoin#765.
- add the implementation of GetKey for `KeyMap`, and also implements it
  for the inner type `DescriptorSecretKey` in order to make the match
branching and logic clearer.
@tcharding
Copy link
Member

Mad, thanks man. I'm off travelling this week but can help review this when I get a chance if needed. I don't do many reviews in miniscript in general.

@apoelstra
Copy link
Member

In 255a61e:

You need to update Cargo-minimal.lock and Cargo-recent.lock to require bitcoin 0.32.6 since the KeyRequest enum was smaller in 0.32.5 and before.

Relatedly, your unreachable! branch is not actually unreachable. It will be hit by any additions to the KeyRequest enum in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement GetKey for KeyMap
3 participants